Writing books in OneNote
#on/writing
- We use a section for a book writing and exporting.
- It doesn't take the entire notebook.
- So that we can still use the other sections to gather material before we put them into the manuscript.
- We use parent pages and sub-pages for parts in a book.
- Each page or sub-page is a chapter.
- Exporting by using the built-in section exporting feature.
- Exporting the section into single-page HTML file
- Which is indeed an
.mht
file, that IE can open it properly
- And then save the file as HTML from IE.
- By having the HTML, we can then use Python and BeautifulSoup to process the HTML element tree into whatever format we want.
- Post-Processing
- The post-process procedure processes the following:
- Margin lines between pages and sub-pages
- We can distinguish parent page and sub-pages by counting the margin lines.
- There are 2 for sub-pages and 3 before a new parent page.
- Images
- The images are in .tmp format
- Which requires further extension conversion.
- Code blocks
- The code block is not any code blocks in the output HTML.
- They are inside a nested table element
- Need to detect these code blocks and apart from the images, which are also inside a table element.
- The target is to process the exported HTML into markdown that LeanPub can read
- To create a flow from writing in OneNote to publishing on LeanPub.